package cn.doitedu.day04

object CaseDemo03 extends App{

  //匹配数组
//  val arr = Array(2,3,4)
//  arr match {
//    case Array(1, x, y) => println(x + " " + y)
//    case Array(0) => println("only 0")
//    case Array(0, _*) => println("0 ...")
//    case _ => println("something else")
//  }

//  val lst = List(0,2,3)
//  lst match {
//    case 0 :: Nil => println("only 0")
//    case x :: y :: Nil => println(s"x: $x y: $y")
//    case 0 :: tail => println("0 ..." + tail)
//    //case 0 :: _ => println("0 ...")
//    case _ => println("something else")
//  }
//
  val tup = (1, 3, 5)
  tup match {
    case (2, x, y) => println(s"2, $x , $y")
    case (_, z, 5) => println(z)
    case  _ => println("else")
  }
}
